package com.girl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {
//    @Value("${cupSize}")
//    private String cupSize;
//    @Value("${age}")
//    private int age;


//    @Value("${content}")
//    private String content;

    @Autowired
    @Qualifier("girlProperty")
    private GirlProperty girlProperty;
//    @RequestMapping(value = {"/say","/hi"},method = RequestMethod.GET)
    //@RequestMapping(value = {"/say/{id}"},method = RequestMethod.GET)//这个在路径中可以传递参数id
  //  public String Say(@PathVariable("id") int id){  //@PathVariable("id")是获取路径中的值
    @GetMapping("/say")
    //@PostMapping(); 和@GetMapping对应
    public String Say(@RequestParam(value="id", required = false,defaultValue = "0") int id){  //这个是获取传递的参数 eg  aa?id=1 request代表是否必须传值，defalutValue为默认String类型
      // return girlProperty.getCupSize()+girlProperty.getAge();
        return "id:"+id;
    }
}
